root@NetStudio:/www/cgi-bin# cat get_gpio.cgi 
#!/bin/sh
# 解析 URL 参数
gpio=$(echo $QUERY_STRING | grep '^gpio=' | cut -d '=' -f 2)

# 获取 GPIO 值
if [ -r "/sys/class/gpio/gpio$gpio/value" ]; then
    value=$(cat /sys/class/gpio/gpio$gpio/value)
    echo "Content-Type: text/plain"
    echo ""
    echo "$value"
else
    echo "Content-Type: text/plain"
    echo ""
    echo "没有权限获取 GPIO 值"
fi
